package com.example.course.vo;

public class Result {
    private Integer code;
    private Object data;
    private String msg;
    public Result(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public Result(Object data) {
        this.code=1;
        this.data = data;
        this.msg="success";
    }
    public Result(String msg) {
        this.code=1;
        this.data = null;
        this.msg=msg;
    }

    /**
     * 成功
     * @return
     */
    public static Result success(){
        return new Result(1,null,"success");
    }

    /**
     * 失败
     * @return
     */
    public static Result fail(){
        return new Result(0,null,"fail");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
